package com.sun.sp.config;

import org.springframework.web.SpringServletContainerInitializer;

import javax.servlet.ServletContainerInitializer;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.HandlesTypes;
import java.util.Set;

@HandlesTypes({MyWebApplicationInitializer.class})
//在实现该接口后，需要在SPI文件中注册，在Servlet容器启动时通过SPI从classpath下查找其实现类，实例化后进行回调。
public class MySpringServletContainerInitializer implements ServletContainerInitializer {
    public void onStartup(Set<Class<?>> set, ServletContext servletContext) throws ServletException {
        MyWebApplicationInitializer myWebApplicationInitializer = new MyWebApplicationInitializer();
        myWebApplicationInitializer.onStartup(servletContext);
    }
}
